const cache = new Map();

cache.set(1, 1);
cache.set(2, 1);

export const caculate = function (num) {
    if (cache.has(num)) return cache.get(num);
    const result = caculate(num - 1) + caculate(num - 2);
    cache.set(num, result);
    return result;
};

console.log(`10->${caculate(10)}`);